<template>
    <el-tree-select v-model="form[item.name]" :data="item.options.items" :check-strictly="item.options.checkStrictly"
        :multiple="item.options.multiple" :show-checkbox="item.options.showCheckbox" collapse-tags
        :max-collapse-tags="2" clearable :multiple-limit="item.options.limit" :size="item.size"
        @focus="treeSelectFocus(item)" :disabled="item.disabled">
    </el-tree-select>
</template>
<script setup>
import { ref, defineModel } from 'vue'
import Api from "@/api/model/system";
const form = defineModel()
const props = defineProps({
    item: { type: Object, default: () => { } }
})
const treeSelectFocus = async (item) => {
    if (item.options.items.length === 0) {
        let params = {
            fileName: item.options.dataset.fileName,
        };
        let res = await Api.select.query.post(params);
        if (res.code == "200") {
            item.options.items = res.reportData;
        }
    }
};
</script>
